package com.seo.pojo.transaction;

import java.io.Serializable;
import java.math.BigDecimal;

import lombok.Data;

/**
 * TransactionFlow
 * 
 * @author Administrator
 * @version 2017.11.30 11:40
 */
@Data
public class TransactionFlow implements Serializable {
	private static final long serialVersionUID = -1281719605469988633L;
	private Long id; // 主键ID
	private Long parentId; // 父级账单ID
	private String code; // 交易流水编码
	private int userId; // 用户ID
	private int parentUserId;//父级用户ID
	private BigDecimal amount; // 金额
	private BigDecimal payAmount; // 支付金额
	private String amountState; // 金额状态
	private String remark; // 备注
	private String state; // 账单状态
	private String type; // 账单类型
	private String createTime; // 创建时间
	private String updateTime; // 更新时间
	private String finishTime; // 完成时间
	private int version; // 版本号
	private int operatorId; // 操作人
	private int reserve1; // 预留字段

	public enum State {
		no("00"), finish("01"), close("02");
		String value;

		State(String value) {
			this.value = value;
		}

		public String getValue() {
			return value;
		}

		public void setValue(String value) {
			this.value = value;
		}

		public boolean equals(String value) {
			return this.value.equals(value);
		}
	}

	public enum AmountState {
		df("00"), pay("01"), in("02");
		String value;

		AmountState(String value) {
			this.value = value;
		}

		public String getValue() {
			return value;
		}

		public void setValue(String value) {
			this.value = value;
		}

		public boolean equals(String value) {
			return this.value.equals(value);
		}
	}

	public enum PayMode {
		wechat("wechat"), balance("balance");
		String value;

		PayMode(String value) {
			this.value = value;
		}

		public String getValue() {
			return value;
		}

		public void setValue(String value) {
			this.value = value;
		}

		public boolean equals(String value) {
			return this.value.equals(value);
		}

		public static boolean isExists(String value) {
			try {
				PayMode.valueOf(value);
				return true;
			} catch (Exception e) {
				return false;
			}
		}
	}
}
